#ifndef DEFINE_FONT2_H
#define DEFINE_FONT2_H

#include "Defination.h"
#include "Rect.h"

namespace swfstream {
class DefineFont2: public Defination {
public:
	//uint id(){return FontID;}
	//uint16 FontID;///< ID for this font character.
	uint8 FontFlagsHasLayout; ///< UB[1] Has font metrics/layout information.
	uint8 FontFlagsShiftJIS; ///< UB[1] ShiftJIS encoding.
	uint8 FontFlagsSmallText; ///< UB[1] SWF 7 or later:Font is small. Character glyphs are aligned on pixel boundaries for dynamic and input text.
	uint8 FontFlagsANSI; ///< UB[1] ANSI encoding.
	uint8 FontFlagsWideOffsets; ///< UB[1] If 1, uses 32 bit offsets.
	uint8 FontFlagsWideCodes; ///< UB[1] If 1, font uses 16-bit codes; otherwise font uses 8 bit codes.
	uint8 FontFlagsItalic; ///< UB[1] Italic Font.
	uint8 FontFlagsBold; ///< UB[1] Bold Font.
	uint8 LanguageCode; // LANGCODE SWF 5 or earlier:always 0 SWF 6 or later:language code
	uint8 FontNameLen; ///< UI8 Length of name.
	uint8* FontName; ///< UI8[FontNameLen] Name of font (see DefineFontInfo).
	uint16 NumGlyphs; ///< UI16 Count of glyphs in font.May be zero for device fonts.
	void* OffsetTable; ///< If FontFlagsWideOffsets, UI32[NumGlyphs]Otherwise UI16[NumGlyphs]Same as in DefineFont.
	uint32 CodeTableOffset; ///< If FontFlagsWideOffsets, UI32Otherwise UI16Byte count from start of OffsetTable to start of CodeTable.
	//GlyphShapeTable SHAPE[NumGlyphs] Same as in DefineFont.
	void* CodeTable; // If FontFlagsWideCodes,    UI16[NumGlyphs]   Otherwise UI8[NumGlyphs]   Sorted in ascending order.   Always UCS-2 in SWF 6 or later.
	int16 FontAscent; ///< If FontFlagsHasLayout, SI16 Font ascender height.
	int16 FontDescent; ///< If FontFlagsHasLayout, SI16 Font descender height.
	int16 FontLeading; ///< If FontFlagsHasLayout, SI16 Font leading height (see following).
	int16* FontAdvanceTable; ///< If FontFlagsHasLayout, 	   SI16[NumGlyphs]	   Advance value to be used for each glyph in dynamic glyph text.
	Rect* FontBoundsTable; ///< If FontFlagsHasLayout, RECT[NumGlyphs]   Not used in Flash Player through version 7 (but must be present).
	/*
	 KerningCount If FontFlagsHasLayout, UI16 Not used in Flash Player through version 7 (always set to 0 to save space).
	 FontKerningTable If FontFlagsHasLayout,
	 KERNINGRECORD [KerningCount]
	 Not used in Flash Player through version 7 (omit with KerningCount of 0).
	 */
	void print();
	static DefineFont2* from_file(FILE*, int);
};
}

#endif
